<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>控制台</title>
<link rel="stylesheet" type="text/css" href="Css/identify.css" />
<link rel="stylesheet" type="text/css" href="Css/layout.css" />
<link rel="stylesheet" type="text/css" href="Css/style.css" />
<link rel="stylesheet" type="text/css" href="Css/control_index.css" />
<link rel="stylesheet" type="text/css" href="Css/risk.css" />
<script type="text/javascript" src="Js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="Js/haidao.offcial.general.js"></script>
<script type="text/javascript" src="Js/select.js"></script>
<script type="text/javascript" src="Js/haidao.validate.js"></script>
<script type="text/javascript">
          var uid=0;
        </script>
<style>
.del {
	background-color: #C00;
	color: #FFF;
	border-radius: 5px;
	line-height: 20px !important;
	padding: 1px 6px;
}
</style>
</head>

<body>
	<div class="view-body">
		<div class="view-sidebar">
			<div class="sidebar-content" id="sidebar"></div>
		</div>

		<div class="view-product">
			<div class="message-manage">
				<div class="manage-head">
					<h6 class="padding-left manage-head-con">${pageName}</h6>
				</div>
				<div class="manage-record margin-lr">
					<span class="fl manage-title border-bottom-main">${tableName}</span>
					<div class="select-table sel_small fr">
						<div>
							<input id="addAction" type="button" value="添加${tableName}"
								onClick="addAction()">
						</div>
					</div>

					<div class="clear"></div>
					<div class="offcial-table margin-top clearfix">
						<div class="tr-th clearfix">

							<table width="100%" border="0">
								<thead>
									<tr>
										<th>ID</th>
										<c:forEach items="${tableHead}" var="m">
											<c:forEach items="${m.value}" var="v">
												<th>${v}</th>
											</c:forEach>
										</c:forEach>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${Datas}" var="d">
										<tr>
											<td>${d.ID}</td>
											<c:forEach items="${tableHead}" var="m">
												<c:forEach items="${m.key}" var="key">
													<td>${d[key]}</td>
												</c:forEach>
											</c:forEach>
											<td align="center"><input class="del" type="button"
												value="删除" onClick="delThis(${d.ID})"></td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="clear"></div>
				<div class="show-page padding-big-right hidden">
					<div class="page"></div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="Js/menu.js"></script>
	<script type="text/javascript">
		  function addAction(){
			  window.location.href='${addActionName}';
		  }
		  function delThis(Tid){
			  if(window.confirm('你确定要删除该条信息吗？')){
				$.ajax({
					 type: "get",
					 url:"/datas/delData?tname=${dataName}&tid="+Tid, 
					 data:{},
					 dataType:'json',
											
					 success: function(resp){
						 if(resp.data){
							location.reload(); 
						 };
					 },
					 error: function(err){}    
				});	
			  }
			}			  
		</script>
</body>

</html>